/**********************************************************************
DO FILE SUMMARY

Rural-Urban Differences in Diabetes Care and Control in 42 Low- and Middle-Income
Countries: A Cross-Sectional Study of Nationally Representative, Individual-Level Data

This is the main files that synthesizes 4 separate analytic files that together run
assessing rural-urban differences in diabetes performance measures using the HPACC dataset.

David Flood, for the HPACC collaborators
University of Michigan

September 24, 2021
**********************************************************************/

clear
cls
version 16	
set more off
capture log close
set showbaselevels
 
* Set graph options and scheme
set scheme s1color
graph set window fontface "Arial"

* Loading original HPACC dataset
use "/Users/davidflood/Dropbox (University of Michigan)/HPACC/Dataset/2021_09_23 - Appended dataset.dta"

* Appending additional files cleaned for this analysis
replace country = "Fiji EHS" if country == "Fiji" // new appended file has Fiji STEPS survey which is labeled "Fiji" in the country variable, so this distinguishes
append using "/Users/davidflood/Dropbox (University of Michigan)/HPACC/Statin paper/Temporary datasets/pooled_new_surveys - 2021.06.29.dta", nolabel

* Randomly restricts dataset to subset of observations to increase speed while cleaning and building code
* gen random_number = runiform()
* drop if random_number > 0.5
* drop if random_number > 0.02 & country == "India"   // drops some India data to improve run speed

* Use the macro $S_DATE to save files with current date
cd "/Users/davidflood/Dropbox (University of Michigan)/HPACC/Rural-urban paper"
global date : di %tdCCYY.NN.DD date("$S_DATE","DMY")
log using "Log files/log_${date}.log", replace

* Run the do files -------------------------------------------------------------

* Rural-urban diabetes analysis 2 - Cleaning - 2021_09_26
do "/Users/davidflood/Dropbox (University of Michigan)/HPACC/Rural-urban paper/Analysis/Rural-urban diabetes analysis 2 - Cleaning - 2021_09_26.do"

* Rural-urban diabetes analysis 3 - Defining outcomes - 2021_09_26	
do "/Users/davidflood/Dropbox (University of Michigan)/HPACC/Rural-urban paper/Analysis/Rural-urban diabetes analysis 3 - Defining outcomes - 2021_09_26.do"

* Rural-urban diabetes analysis 4 - Analysis and appendices - 2021_09_26
do "/Users/davidflood/Dropbox (University of Michigan)/HPACC/Rural-urban paper/Analysis/Rural-urban diabetes analysis 4 - Analysis and appendices - 2021_09_26.do"

* Rural-urban diabetes analysis 5 - Sensitivity analyses - 2021_09_26
do "/Users/davidflood/Dropbox (University of Michigan)/HPACC/Rural-urban paper/Analysis/Rural-urban diabetes analysis 5 - Sensitivity analyses - 2021_09_26.do"	

* End of do files --------------------------------------------------------------
	
log close


		
		
	
